-
-
Notifications
You must be signed in to change notification settings - Fork 292
Implement persistent foreground service to keep calls active in background, with notification controls for managing the call #5660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…round, with notification controls for managing the call - Add CallForegroundService with persistent notification - Support calls in background without requiring picture-in-picture mode - Add "Return to call" and "End call" action buttons to CallForegroundService notification with corresponding PendingIntent - Handle proper foreground service types for microphone/camera permissions - Add notification permission and fallback messaging. - Add EndCallReceiver to handle end call broadcasts from notification action - Use existing ic_baseline_close_24 drawable for end call action icon - Register broadcast receiver in CallActivity to handle end call requests from notification using ReceiverFlag.NotExported for Android 14+ compatibility - Add proper cleanup flow: notification action → EndCallReceiver → CallActivity → proper hangup sequence - Track intentional call leaving to prevent unwanted service restarts - Release proximity sensor lock properly during notification-triggered hangup - Add diagnostic logging throughout the end call flow for debugging The implementation follows Android best practices: - Uses NotExported receiver flag for internal app-only broadcasts - Properly unregisters receivers in onDestroy to prevent leaks - Uses immutable PendingIntents for security - Maintains proper state management during call termination Signed-off-by: Tarek Loubani <[email protected]>
74d1035 to
ce14a04
Compare
…tyle Signed-off-by: Tarek Loubani <[email protected]>
|
Thank you for the PR @tareko |
|
Hello there, We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process. Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6 Thank you for contributing to Nextcloud and we hope to hear from you soon! (If you believe you should not receive this message, you can add yourself to the blocklist.) |
mahibi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @tareko
Also thanks to let us know that AI was used.
The code looks okay so far from my side.
I tested and it works quite fine.
But i had one situation that is a blocker (could not reproduce it yet):
I think i pressed the hangup button in the app.
The app froze, but audio connection was oneside from web to android.
Even when i killed the app and also the notification was not shown anymore, the onesided audio connection continued.
We will have to test and analyze how this happens.
I might not find enough time in the next weeks to analyze and test appropriately.
So @sowjanyakch and @rapterjet2004 , please also review and test.
@tareko Could you also please fix the warnings in
https://app.codacy.com/gh/nextcloud/talk-android/pull-requests/5660/issues
?
| if (java.lang.Boolean.TRUE == audioPermission) { | ||
| Log.d(TAG, "Microphone permission was granted") | ||
| } else { | ||
| Log.d(TAG, "Microphone permission was denied") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...was denied" logs are misleading here.
While the "...was granted" indicate that that some permission is already available, the else branch will just add strings to the dialog that tell why permission xy should be granted.
So the logs should better be "... permission is not yet grnated and will be asked for"
|
|
||
| // DIAGNOSTIC: Logging icon resource availability | ||
| Log.d("CallForegroundService", "Creating end call action - checking icon resources") | ||
| Log.d("CallForegroundService", "Using ic_baseline_close_24 instead of non-existent ic_close_white_24px") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these diagnostic logs/comments about the icon should be deleted?
| } | ||
|
|
||
| // Broadcast receiver to handle end call from notification | ||
| private val endCallFromNotificationReceiver = object : BroadcastReceiver() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please move this receiver up above the companion object
| @@ -0,0 +1,3 @@ | |||
| { | |||
| "java.configuration.updateBuildConfiguration": "interactive" | |||
| } No newline at end of file | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you remove the file and add
.vscode/
to gitignore?
This PR is in response to Issue #1688 . In summary, if PIP is not available, the call ends and this should not happen. I used ChatGPT Codex, Claude, and localAI via Qwen3-coder to generate the code in this PR. Within my personal programming abilities, I still believe the code is elegant. I've used the test app for several calls with no issues on a P6P with latest android.
This PR implements two key functions:
a. Allows users to return to the call
b. Allows users to end an active call directly from the persistent notification without needing to return to the CallActivity
Features
The implementation follows Android best practices:
🏁 Checklist
/backport to stable-xx.x